package com.example.demo.controller;


import com.example.demo.entity.AlarmPlatform;
import com.example.demo.service.AlarmPlatformService;
import com.example.demo.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/alarmPlatform")

public class AlarmPlatformController {

    @Autowired
    private AlarmPlatformService alarmPlatformService;


    @GetMapping("/getAll")
    public Result<List<AlarmPlatform>> selectAll(){
        return Result.success(alarmPlatformService.getAll());
    }

    @PostMapping("/create")
    public Result<Boolean> create(@RequestBody AlarmPlatform alarmPlatform){
        return Result.success(alarmPlatformService.create(alarmPlatform));
    }

    @PostMapping("/update")
    public Result<Boolean> update(@RequestBody AlarmPlatform alarmPlatform){
        return Result.success(alarmPlatformService.update(alarmPlatform));
    }

    @DeleteMapping("/delete/{uuid}")
    public Result<Boolean> delete(@PathVariable String uuid){
        return Result.success(alarmPlatformService.delete(uuid));
    }
}
